import {useMainConfigStore} from "@/store/mainConfigStore";
import pinia from "@/store/store";

const mainConfigStore = useMainConfigStore(pinia)

export function processExcelData(results) {
    let startTime = new Date().getTime();

    var columnNamePropMap = mainConfigStore.columnNamePropMap;
    for (let i = 0; i < results.length; i++) {
        let item = results[i];
        for (const itemKey in item) {
            // eslint-disable-next-line no-prototype-builtins
            if (columnNamePropMap.hasOwnProperty(itemKey)) {
                item[columnNamePropMap[itemKey]] = item[itemKey]
                delete item[itemKey];
            }
        }
    }
    let endTime = new Date().getTime();

    console.log("加载耗时：" + (endTime - startTime) / 1000 + 's')
    return results;
}